<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="90px">
      <el-form-item label="投诉用户" prop="complaintName">
        <el-input
          v-model="queryParams.complaintName"
          placeholder="请输入投诉用户"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="执法人员" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="请输入执法人员"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="投诉类型" prop="complaintTypeId">
        <el-select v-model="queryParams.complaintTypeId" placeholder="请选择投诉类型" clearable size="small">
          <el-option
            v-for="item in xhcgComplaintTypeList"
            :key="item.id"
            :label="item.name"
            :value="item.id"
            size="small"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="反馈状态" prop="feedbackStatus">
        <el-select v-model="queryParams.feedbackStatus" placeholder="请选择反馈审核状态" clearable size="small">
          <el-option
            v-for="dict in feedbackStatusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
            size="small"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="投诉状态" prop="complaintStatus">
        <el-select v-model="queryParams.complaintStatus" placeholder="请选择投诉审核状态" clearable size="small">
          <el-option
            v-for="dict in complaintStatusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="发布投诉栏" prop="status">
        <el-select v-model="queryParams.issueStatus" placeholder="请选择投诉栏状态" clearable size="small">
          <el-option
            v-for="dict in issueStatusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="处理状态" prop="status">
        <el-select v-model="queryParams.disposeStatus" placeholder="请选择处理状态" clearable size="small">
          <el-option
            v-for="dict in disposeStatusStatusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="审核人员" prop="auditBy">
        <el-input
          v-model="queryParams.auditBy"
          placeholder="请输入审核人员"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="执法部门" prop="deptId">
        <treeselect v-model="queryParams.deptId"   :options="deptOptions" style="width:200px" :show-count="true" placeholder="请选择执法部门" />
      </el-form-item>
      <el-form-item label="日期范围" prop="time">
        <el-date-picker type="daterange" v-model="queryParams.date" format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd " :style="{width: '100%'}" start-placeholder="开始日期" end-placeholder="结束日期"
                        range-separator="至" clearable></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="danger"-->
<!--          icon="el-icon-delete"-->
<!--          size="mini"-->
<!--          :disabled="multiple"-->
<!--          @click="handleDelete"-->
<!--          v-hasPermi="['xhcg:complaint:remove']"-->
<!--        >删除</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['xhcg:complaint:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
    </el-row>

    <el-table v-loading="loading" :data="complaintList" @selection-change="handleSelectionChange">
<!--      <el-table-column type="selection" width="55" align="center" />-->
      <el-table-column label="投诉用户" align="center" prop="complaintName" />
      <el-table-column label="投诉类型" align="center" prop="typeName" />
      <el-table-column label="执法部门" align="center" prop="deptName" />
      <el-table-column label="执法人员" align="center" prop="zfNickName" />
      <el-table-column label="投诉时间" align="center" prop="complaintTime" width="150">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.complaintTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="反馈时间" align="center" prop="feedbackTime" width="150">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.feedbackTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核时间" align="center" prop="auditTime" width="150">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="投诉状态" align="center" prop="complaintStatus" >
        <template slot-scope="scope">
          <span :class="'complaintStatus_'+scope.row.complaintStatus">{{complaintStatusFormat(scope.row)}}</span>
        </template>
      </el-table-column>
      <el-table-column label="反馈状态" align="center" prop="feedbackStatus" >
        <template slot-scope="scope">
          <span :class="'feedbackStatus_'+scope.row.feedbackStatus">{{feedbackStatusFormat(scope.row)}}</span>
        </template>
      </el-table-column>
      <el-table-column label="处理状态" align="center" prop="disposeStatus" >
        <template slot-scope="scope">
          <span :class="'disposeStatus_'+scope.row.disposeStatus">{{disposeStatusFormat(scope.row)}}</span>
        </template>
      </el-table-column>
      <el-table-column label="倒计时间" align="center" prop="disposeStatus" />
      <el-table-column label="发布投诉栏" align="center" prop="issueStatus" >
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.issueStatus"
            v-if="scope.row.feedbackStatus==2"
            active-value="1"
            inactive-value="0"
            v-hasPermi="['xhcg:complaint:issue']"
            @change="issueHandleUpdate(scope.row)"
          ></el-switch>
        </template>
      </el-table-column>
      <el-table-column label="审核人员" align="center" prop="auditBy" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="280">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            v-if="scope.row.complaintStatus ==0 || scope.row.feedbackStatus==4"
            icon="el-icon-edit"
            @click="cHandleUpdate(scope.row)"
            v-hasPermi="['xhcg:complaint:cAudit']"
          >投诉审核</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            v-if="scope.row.complaintStatus==1 && (scope.row.feedbackStatus == 1)"
            @click="fHandleUpdate(scope.row)"
            v-hasPermi="['xhcg:complaint:fAudit']"
          >反馈审核</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-zoom-in"
            @click="handleView(scope.row)"
            v-hasPermi="['xhcg:complaint:view']"
          >查看详情</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['xhcg:complaint:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改西湖城管-投诉对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
          <el-row :gutter="20">
            <el-col :span="10">
              <el-form-item label="投诉用户" prop="complaintName">
                <el-input v-model="form.complaintName" placeholder="请输入投诉用户" disabled="disabled" />
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label="联系方式" prop="phone" >
                <el-input v-model="form.phone" placeholder="请输入联系方式" disabled="disabled"  />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="10">
              <el-form-item label="投诉时间" prop="complaintTime">
                <el-date-picker clearable   disabled="disabled" style="width: 100%"
                                v-model="form.complaintTime"
                                type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                placeholder="选择投诉时间">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label="投诉类型">
                <el-select v-model="form.typeName" placeholder="请选择投诉类型" style="width: 100%"  disabled="disabled" >
                  <el-option label="请选择字典生成" value="" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="10">
              <el-form-item label="具体位置" prop="specificLocation">
                <el-input v-model="form.specificLocation" placeholder="请输入具体位置" disabled="disabled"  />
              </el-form-item>
              <!--            <el-form-item label="街道" prop="street">-->
              <!--              <el-input v-model="form.street" placeholder="请输入街道" disabled="disabled"  />-->
              <!--            </el-form-item>-->
            </el-col>
            <el-col :span="10">
              <el-form-item label="执法部门">
                <treeselect v-model="form.deptId" :options="deptOptions"  :disabled="isComplaintImg != 0" :show-count="true" placeholder="请选择执法部门" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-form-item label="投诉原因" prop="complaintCause">
            <el-input v-model="form.complaintCause" type="textarea"  placeholder="请输入投诉原因" disabled="disabled"  />
          </el-form-item>
          <el-form-item label="投诉说明" prop="complaintExplain">
            <el-input v-model="form.complaintExplain" type="textarea"    placeholder="请输入投诉说明" disabled="disabled"  />
          </el-form-item>
          <el-form-item label="投诉凭证" prop="complaintImgUrl" >
                <div class="block"  v-for="img in complaintImgUrlList" :key="img" style="display: inline;">
                  <el-image :src="base_url+img" :preview-src-list="previewList"  :z-index="2500" 
                            style="height: 100px;width: 100px;margin-left: 5px;"  />
                </div>
                <div class="block"  v-for="img in complaintVideoUrlList" :key="img" >
                  <video  :src="base_url+img" :preview-src-list="previewList"style="height: 112px;width: 200px;margin-left: 5px"
                          class="avatar" controls="controls"></video>
                </div>
          </el-form-item>
          <el-row :gutter="20">
            <el-col :span="10">
              <el-form-item label="投诉状态">
                <el-select v-model="form.complaintStatus" placeholder="请选择投诉状态" style="width: 100%" :disabled="isComplaintImg != 0">
                  <el-option  v-if="isComplaintImg != 2" label="通过" value="1"></el-option>
                  <el-option  v-if="isComplaintImg != 2" label="不通过" value="2"></el-option>
                  <el-option
                    v-for="dict in complaintStatusOptions" v-if="isComplaintImg == 2"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="10">
            <el-form-item label="处理倒计时" prop="complaintTime">
              <el-select v-model="form.countDown" placeholder="请选择处理倒计时" style="width: 100%" :disabled="isComplaintImg != 0">
                <el-option   label="1小时" value="1"></el-option>
                <el-option  label="2小时" value="2"></el-option>
                <el-option   label="24小时" value="24"></el-option>
                <el-option  label="2天" value="48"></el-option>
                <el-option   label="3天" value="72"></el-option>
                <el-option  label="7天" value="168"></el-option>
                <el-option   label="14天" value="336"></el-option>
                <el-option  label="30天" value="720"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          </el-row>
        <el-row v-if="isComplaintImg==1 || (isComplaintImg == 2 && isXfTs == 1)">
          <el-row :gutter="20">
            <el-col :span="10">
              <el-form-item label="执法人员" prop="sysUserId">
                <el-input v-model="form.zfNickName" placeholder="请输入执法人员" disabled="disabled"  />
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label="反馈时间" prop="feedbackTime">
                <el-date-picker clearable style="width: 100%" disabled="disabled"
                                v-model="form.feedbackTime"
                                type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss "
                                placeholder="选择反馈时间">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
            <el-form-item label="反馈内容" prop="feedbackContent">
              <el-input v-model="form.feedbackContent" disabled="disabled"  :autosize="{ minRows: 2, maxRows: 6}" type="textarea" placeholder="请输入内容" />
            </el-form-item>
            <el-form-item label="反馈凭证" prop="feedbackVoucherUrl" >
                <div class="block"  v-for="img in feedbackVoucherUrlList" disabled="disabled"  :key="img" style="display: inline;">
                  <el-image  :src="base_url+img" :preview-src-list="previewList"  :z-index="2500" style="height: 100px;width: 100px;margin-left: 5px;" />
                </div>
                <div class="block"  v-for="img in feedbackVideoUrlList" disabled="disabled"  :key="img" >
                  <video :src="base_url+img" style="height: 112px;width: 200px;margin-left: 5px;" class="avatar" controls="controls"></video>
                </div>
            </el-form-item>
          <el-row :gutter="20">
            <el-col :span="10">
              <el-form-item label="反馈状态">
                <el-select v-model="form.feedbackStatus" style="width: 100%"  placeholder="请选择反馈审核状态" :disabled="isComplaintImg == 2">
                  <el-option v-if="isComplaintImg != 2" label="通过"  value="2" selected ></el-option>
                  <el-option v-if="isComplaintImg != 2" label="不通过" value="3"></el-option>
                  <el-option v-if="isComplaintImg == 2"
                             v-for="dict in feedbackStatusOptions"
                             :key="dict.dictValue"
                             :label="dict.dictLabel"
                             :value="dict.dictValue"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="10">
            </el-col>
          </el-row>
        </el-row>
        <el-form-item label="拒绝原因" prop="rejectCause" v-if="(form.complaintStatus == 2 && isComplaintImg == 0) || form.feedbackStatus == 3">
          <el-input v-model="form.rejectCause" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="查看" prop="rejectCause">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="zfHandleUpdate()"
            v-hasPermi="['xhcg:complaint:fAudit']"
          >审核记录</el-button>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" :hidden="isComplaintImg==2">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 执法详情 -->
    <el-dialog :title="title1" :visible.sync="open1" width="680px" append-to-body>
      <template>
        <el-table
          :data="recordList"
          style="width: 100%">
          <el-table-column label="操作时间" align="center" prop="enforceTime" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.enforceTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="部门" align="center" prop="deptName" />
          <el-table-column label="操作人" align="center" prop="zfNickName" />
          <el-table-column label="操作状态" align="center" prop="status" >
          <template slot-scope="scope">
            <span :class="'zfStatus_'+scope.row.status">{{statusFormat(scope.row)}}</span>
          </template>
          </el-table-column>
          <el-table-column label="描述" align="center" prop="cause" />
        </el-table>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { listComplaint,getXhcgComplaintTypeList,deptTreeselect as deptTreeselect, getComplaint, delComplaint,issueComplaint,addComplaint, updateComplaint, exportComplaint } from "@/api/xhcg/complaint";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  name: "Complaint",
  components: { Treeselect },
  data() {
    return {
      isComplaintImg: 0,
      isXfTs:0,
      base_url: process.env.VUE_APP_BASE_API,
      xhcgComplaintTypeList: null,//类型
      complaintImgUrlList:[],//投诉图片
      complaintVideoUrlList:[],//投诉视频
      feedbackVoucherUrlList:[],//反馈图片
      feedbackVideoUrlList:[],//反馈视频
      statusOptions: [],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 部门列表
      deptOptions: [],
      // 西湖城管-投诉表格数据
      complaintList: [],
      // 弹出层标题
      title: "",
      title1: "",
      // 是否显示弹出层
      open: false,
      open1:false,
      // 反馈审核状态(0待审核1通过2不通过)字典
      feedbackStatusOptions: [],
      // 投诉审核状态(0待审核1通过2不通过)字典
      complaintStatusOptions: [],
      // 是否发布到投诉栏(0下架1发布)
      issueStatusOptions: [],
      //投诉处理状态
      disposeStatusStatusOptions: [],
      recordList: [],//投诉操作记录
      previewList:[],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        wxUserId: undefined,
        deptId: undefined,
        sysUserId: undefined,
        feedbackTime: undefined,
        feedbackContent: undefined,
        feedbackVoucherUrl: undefined,
        complaintTime: undefined,
        complaintExplain: undefined,
        complaintImgUrl: undefined,
        complaintTypeId: undefined,
        complaintCause: undefined,
        phone: undefined,
        feedbackStatus: undefined,
        complaintStatus: undefined,
        rejectCause: undefined,
        auditTime: undefined,
        auditBy: undefined,
        specificLocation: undefined,
        street: undefined,
        wxClientId: undefined,
        complaintName: undefined,
        userName: undefined,
        issueStatus: undefined,
        startTime: undefined,
        stopTime: undefined,
        date:undefined,
        disposeStatus:undefined,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("feedback_status").then(response => {
      this.feedbackStatusOptions = response.data;
    });
    this.getDicts("complaint_status").then(response => {
      this.complaintStatusOptions = response.data;
    });
    getXhcgComplaintTypeList().then(response => {
      this.xhcgComplaintTypeList = response.data;
    });
    this.getDicts("complaint_record_status").then(response => {
      this.statusOptions = response.data;
    });
    this.getDicts("complaint_issue_status").then(response => {
      this.issueStatusOptions = response.data;
    });
    this.getDicts("xhcg_complaint_dispose_status").then(response => {
      this.disposeStatusStatusOptions = response.data;
    });
    this.getDeptTreeselect();
  },
  methods: {
    /** 查询西湖城管-投诉列表 */
    getList() {
      this.loading = true;
      let startDate=this.queryParams.date;
      if(startDate){
        console.log(startDate)
        this.queryParams.startTime=startDate[0];
        if(startDate.length > 1){
          this.queryParams.stopTime=startDate[1]
        }
      }
      this.queryParams.date = undefined;
      listComplaint(this.queryParams).then(response => {
        this.complaintList = response.rows;
        this.total = response.total;
        //回显日期
        this.queryParams.date = startDate;
        this.loading = false;
      });
    },
    /** 查询部门树结构 */
    getDeptTreeselect() {
      deptTreeselect().then(response => {
        this.deptOptions = response.data;
      });
    },
    // 反馈审核状态(0待审核1通过2不通过)字典翻译
    feedbackStatusFormat(row, column) {
      return this.selectDictLabel(this.feedbackStatusOptions, row.feedbackStatus);
    },

    // 投诉处理状态
    disposeStatusFormat(row, column) {
      return this.selectDictLabel(this.disposeStatusStatusOptions, row.disposeStatus);
    },
    // 投诉审核状态(0待审核1通过2不通过)字典翻译
    complaintStatusFormat(row, column) {
      return this.selectDictLabel(this.complaintStatusOptions, row.complaintStatus);
    },
    issueStatusFormat(row, column) {
      return this.selectDictLabel(this.issueStatusOptions, row.issueStatus);
    },
    // 执法状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        wxUserId: undefined,
        deptId: undefined,
        sysUserId: undefined,
        feedbackTime: undefined,
        feedbackContent: undefined,
        feedbackVoucherUrl: undefined,
        complaintTime: undefined,
        complaintExplain: undefined,
        complaintImgUrl: undefined,
        complaintTypeId: undefined,
        complaintCause: undefined,
        phone: undefined,
        delFlag: undefined,
        feedbackStatus: "0",
        complaintStatus:  "0",
        rejectCause: undefined,
        auditTime: undefined,
        auditBy: undefined,
        specificLocation: undefined,
        street: undefined,
        wxClientId: undefined,
        countDown:undefined,
        disposeStatus:'0',
      };
      this.isComplaintImg = 0;
      this.isComplaintImg= 0;
      this.isXfTs= 0;
      this.complaintImgUrlList= [];//投诉图片
      this.complaintVideoUrlList= [];//投诉视频
      this.feedbackVoucherUrlList= [];//反馈图片
      this.feedbackVideoUrlList= [];//反馈视频
    // this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加西湖城管-投诉";
    },
    /** 投诉审核按钮操作 */
    cHandleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      this.previewList = [];
      getComplaint(id).then(response => {
        console.log(response.data)
        this.form = response.data.xhcgComplaint;
        this.recordList = response.data.recordList;
        this.complaintImgUrlList = response.data.xhcgComplaint.complaintImgUrlList;
        this.complaintVideoUrlList = response.data.xhcgComplaint.complaintVideoUrlList;
        this.open = true;
        this.title = "投诉审核";
        this.isComplaintImg = 0;
        response.data.xhcgComplaint.complaintImgUrlList.filter(e=>{
          this.previewList.push(this.base_url + e);
        })
        if(this.form.complaintStatus != 2){
          this.form.complaintStatus='1';//通过
        }
      });
    },
    /** 反馈审核按钮操作 */
    fHandleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      this.previewList = [];
      getComplaint(id).then(response => {
        console.log(response.data)
        this.form = response.data.xhcgComplaint;
        this.recordList = response.data.recordList;
        this.feedbackVoucherUrlList = response.data.xhcgComplaint.feedbackVoucherUrlList;
        this.feedbackVideoUrlList = response.data.xhcgComplaint.feedbackVideoUrlList;
        this.complaintImgUrlList = response.data.xhcgComplaint.complaintImgUrlList;
        this.complaintVideoUrlList = response.data.xhcgComplaint.complaintVideoUrlList;
        this.open = true;
        this.title = "反馈审核";
        this.isComplaintImg = 1;
        response.data.xhcgComplaint.feedbackVoucherUrlList.filter(e=>{
          this.previewList.push(this.base_url + e);
        })
        // if(this.form.feedbackStatus != 3){
          this.form.feedbackStatus='2';//通过
        // }
      });
    },
    zfHandleUpdate() {
      this.open1 = true;
      this.title1 = "审核记录";
    },
    handleView(row) {
      this.reset();
      const id = row.id || this.ids
      this.previewList = [];
      getComplaint(id).then(response => {
        console.log(response.data)
        this.open = true;
        this.title = "查看详情";
        this.form = response.data.xhcgComplaint;
        this.recordList = response.data.recordList;
        this.isComplaintImg = 2;
        //投诉通过与反馈中
        if(row.complaintStatus == 1 && row.feedbackStatus == 2){
            this.isXfTs= 1;
            this.feedbackVoucherUrlList = response.data.xhcgComplaint.feedbackVoucherUrlList;
            this.feedbackVideoUrlList = response.data.xhcgComplaint.feedbackVideoUrlList;
            response.data.xhcgComplaint.feedbackVoucherUrlList.filter(e=>{
              this.previewList.push(this.base_url + e);
            })
        }
        //显示投诉与反馈信息
        this.complaintImgUrlList = response.data.xhcgComplaint.complaintImgUrlList;
        this.complaintVideoUrlList = response.data.xhcgComplaint.complaintVideoUrlList;
        response.data.xhcgComplaint.complaintImgUrlList.filter(e=>{
          this.previewList.push(this.base_url + e);
        })
      });
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != undefined) {
            updateComplaint(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              }
            });
          } else {
            addComplaint(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              }
            });
          }
        }
      });
    },
    issueHandleUpdate(row) {
      let text = row.issueStatus === "0" ? "下架" : "发布";
      this.$confirm('确认要' + text + '吗?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return issueComplaint(row.id, row.issueStatus);
      }).then(() => {
        this.getList();
        this.msgSuccess(text + "成功");
      }).catch(function() {
        row.issueStatus = row.issueStatus === "0" ? "1" : "0";
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除西湖城管-投诉编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delComplaint(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有西湖城管-投诉数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportComplaint(queryParams);
        }).then(response => {
          this.download(response.msg);
        }).catch(function() {});
    }
  }
};
</script>
<style scoped>


  .issueStatus_0{
    color: red!important;
  }
  .issueStatus_1{
    color: green;
  }
  .complaintStatus_0{
    color: orange!important;
  }
  .complaintStatus_1{
    color: green;
  }
  .complaintStatus_2{
    color: red;
  }

  .feedbackStatus_0{
    color: orange!important;
  }
  .feedbackStatus_1{
    color: deepskyblue;
  }
  .feedbackStatus_2{
    color: green;
  }
  .feedbackStatus_3{
    color: red;
  }
  .feedbackStatus_4{
    color: red;
  }


  .disposeStatus_0{
    color: orange!important;
  }
  .disposeStatus_1{
    color: green;
  }
  .disposeStatus_2{
    color: deepskyblue;
  }
  .disposeStatus_3{
    color: red;
  }
  .disposeStatus_4{
    color: red;
  }



  .zfStatus_0{
    color: green!important;
  }
  .zfStatus_1{
    color: red;
  }
  .image2 {
    width: 100px;
    height: 100px;
    border-style: none;

  }
</style>

